{% extends 'base.html' %}

{% block title %}更新节点{% endblock %}

{% block body %}
<section class="login">
    <h1 class="heading"> <span>节点</span> Node </h1>
    <div class="row">

        <form method="post" novalidate>
            {{ form.csrf_token() }}

            {{ form.ip.label }}
            {{ form.ip }}
            {% if form.ip.errors.0 %}
            <div class="error">
                <span>{{ form.ip.errors.0 }}</span>
            </div>
            {% endif %}

            {{ form.area.label }}
            {{ form.area }}
            {% if form.area.errors.0 %}
            <div class="error">
                <span>{{ form.area.errors.0 }}</span>
            </div>
            {% endif %}

            {{ form.login_url.label }}
            {{ form.login_url }}
            {% if form.login_url.errors.0 %}
            <div class="error">
                <span>{{ form.login_url.errors.0 }}</span>
            </div>
            {% endif %}

            <style>
                select {
                    appearance:none;
                    -moz-appearance:none;
                    -webkit-appearance:none;
                }
                select::-webkit-scrollbar{
                    display: none;
                }
            </style>

            {{ form.server_provider.label }}
            {{ form.server_provider }}
            {% if form.server_provider.errors.0 %}
            <div class="error">
                <span>{{ form.server_provider.errors.0 }}</span>
            </div>
            {% endif %}

            {{ form.server_url.label }}
            {{ form.server_url }}
            {% if form.server_url.errors.0 %}
            <div class="error">
                <span>{{ form.server_url.errors.0 }}</span>
            </div>
            {% endif %}

            {{ form.security_code.label }}
            {{ form.security_code }}
            {% if form.security_code.errors.0 %}
            <div class="error">
                <span>{{ form.security_code.errors.0 }}</span>
            </div>
            {% endif %}

            {{ form.server_account.label }}
            {{ form.server_account }}
            {% if form.server_account.errors.0 %}
            <div class="error">
                <span>{{ form.server_account.errors.0 }}</span>
            </div>
            {% endif %}

            {{ form.server_password.label }}
            {{ form.server_password }}
            {% if form.server_password.errors.0 %}
            <div class="error">
                <span>{{ form.server_password.errors.0 }}</span>
            </div>
            {% endif %}

            <div class="loginBtn">
                {{ form.submit() }}
            </div>
        </form>
    </div>
</section>

{% endblock %}

{% block footer %}
{{ super() }}
{% endblock %}

{% block script %}
    <script>
        window.onload=function(){
            var opts  = document.querySelector("#server_type");
            
            for(var i = 0; i < opts.options.length; i++)
            {
                console.log(i + ' : ' + opts.options[i].value);
                opts.options[i].setAttribute('class',' pv3 ma2 tc f3 fw6 br4 ba b--dashed b--light-pink bw2');
            }
    }
    </script>
{% endblock %}